﻿using System;

class TheAccurateSum

            // Write a program to calculate the sum (with accuracy of 0.001): 1 + 1/2 - 1/3 + 1/4 - 1/5 + ...

{
    static void Main()
    {
        decimal now = 2;
        decimal sum = 1;
        int sign = 1;
        while (now <= 1000)
        {
            sum = sum + 1 / (sign * now);
            now = now + 1;
            sign = sign * (-1);
        }
        Console.WriteLine("{0:0.000}", sum);
    }
}

